# -*- coding: utf-8 -*-
# @Time    : 2024/1/4 21:15
# @Author  : micah
# @File    : 11.重定向与历史请求.py
# @Software: PyCharm


import requests

headers = {
    "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
}

# allow_redirects=False: 禁止重定向
response = requests.get('http://www.baidu.com', headers=headers, allow_redirects=False)
print(response.url)
